<template>
  <div class="page-home">
    <div class="home-entry">
      <div class="container">
        <!-- 左侧分类 -->
        <HomeCategory />
        <!-- banner轮播图 -->
        <HomeBanner/>

         <!--
          Vue3 新特性：Suspense 组件
        1. 可配合异步组件使用，加载的 loading 效果可以放 #fallback 插槽中
        2. 被 Suspense 默认插槽包裹的组件，可以用 async setup ( setup 返回 Promise 能被处理 )
        -->
        <Suspense>
          <template #default>
            <div>
              <!-- 楼层新鲜好物 -->
              <HomeNew/>
              <!-- 人气推荐 -->
              <HomeHot/>
            </div>
          </template>
          <template #fallback>
            <h1>Loading...</h1>
          </template>
        </Suspense>
      </div>
    </div>
  </div>
</template>
<script>
import HomeCategory from './components/home-category.vue'
import HomeBanner from './components/home-banner.vue'
import HomeNew from './components/home-new.vue'
// import HomeHot from './components/home-hot.vue'
import { defineAsyncComponent } from 'vue'
export default {
  name: 'PageHome',
  components: { HomeCategory, HomeBanner, HomeNew, HomeHot: defineAsyncComponent(() => import('./components/home-hot.vue')) }
}
</script>
